package sgd.tp2.api.logging;

import java.text.MessageFormat;

public final class Log {

	private static void outputText(LogType type, boolean newLine, String textPattern,
			Object... arguments) {
		System.out.print("[" + type + "] " + MessageFormat.format(textPattern, arguments)
				+ (newLine ? "\n" : ""));
	}

	public static void insertString(String text) {
		System.out.print(text);
	}

	public static void infoln(String textPattern, Object... arguments) {
		outputText(LogType.INFO, true, textPattern, arguments);
	}

	public static void errorln(String textPattern, Object... arguments) {
		outputText(LogType.ERROR, true, textPattern, arguments);
	}

	public static void warningln(String textPattern, Object... arguments) {
		outputText(LogType.WARNING, true, textPattern, arguments);
	}

	public static void info(String textPattern, Object... arguments) {
		outputText(LogType.INFO, false, textPattern, arguments);
	}

	public static void error(String textPattern, Object... arguments) {
		outputText(LogType.ERROR, false, textPattern, arguments);
	}

	public static void warning(String textPattern, Object... arguments) {
		outputText(LogType.WARNING, false, textPattern, arguments);
	}
}
